#include "ShareMemory.hpp"

int main()
{
    //1、获取key，创建共享内存
    shm.CreatShm();
    //2、将共享内存挂接到地址空间
    shm.AttachShm();

    gpipe.OpenPipeForRead();

    struct data *image = (struct data*)shm.GetAddr();
    while (true)
    {
        gpipe.Wait();//在管道中阻塞,接收用户在管道中发送写入完毕信号

        printf("status : %s\n", image->status);
        printf("lasttime : %s\n", image->lasttime);
        printf("image : %s\n", image->image);
        strcpy(image->status, "过期");

        // cout << strinfo << endl;
        // sleep(1);
    }

    //3、去关联
    shm.DetachShm();
    //4、删除
    shm.DeleteShm();
    return 0;
}
